package top.greatxiaozou.adapterPattern;

public class Adapter implements MediaPlayer {
    public AdvanceMediaPlayer advanceMediaPlayer;

    public Adapter(String type) {
        if (type.equals("vlc")) {
            advanceMediaPlayer = new VlcPalyer();
            return;
        }
        if (type.equals("mp4")) {
            advanceMediaPlayer = new Mp4Player();
            return;
        }
    }

    @Override
    public void play(String type, String fileName) {
        if (type.equals("vlc")) {
            advanceMediaPlayer.playVlc(fileName);
            return;
        }
        if (type.equals("mp4")) {
            advanceMediaPlayer.playMp4(fileName);
        }
    }
}
